#pragma once
#include "CJsonObject.hpp"
#include "Utils.h"
#include <iostream>
class CTest
{
public:
	CTest() {};
	~CTest() {};
	void testJson() {
		int iValue;
		double fTimeout;
		std::string strValue;
		string josnStr = CUtils::readFileIntoString("./conf/config.ini");
		cout << josnStr << endl;

		neb::CJsonObject oJson1(josnStr);
		std::cout << oJson1.ToString() << std::endl;
		std::cout << "-------------------------------------------------------------------" << std::endl;
		std::cout << oJson1("pano_interval") << std::endl;

		neb::CJsonObject oJson("{\"refresh_interval\":60,"
			"\"test_float\":[18.0, 10.0, 5.0],"
			"\"timeout\":12.5,"
			"\"dynamic_loading\":["
			"{"
			"\"so_path\":\"plugins/User.so\", \"load\":false, \"version\":1,"
			"\"cmd\":["
			"{\"cmd\":2001, \"class\":\"neb::CmdUserLogin\"},"
			"{\"cmd\":2003, \"class\":\"neb::CmdUserLogout\"}"
			"],"
			"\"module\":["
			"{\"path\":\"im/user/login\", \"class\":\"neb::ModuleLogin\"},"
			"{\"path\":\"im/user/logout\", \"class\":\"neb::ModuleLogout\"}"
			"]"
			"},"
			"{"
			"\"so_path\":\"plugins/ChatMsg.so\", \"load\":false, \"version\":1,"
			"\"cmd\":["
			"{\"cmd\":2001, \"class\":\"neb::CmdChat\"}"
			"],"
			"\"module\":[]"
			"}"
			"]"
			"}");
		std::cout << oJson.ToString() << std::endl;
		std::cout << "-------------------------------------------------------------------" << std::endl;
		std::cout << oJson["dynamic_loading"][0]["cmd"][1]("class") << std::endl;
	}
};

